package com.gimi.cloud.mmf.user.common.enums;


/**
 * 返回代码状态
 *
 */
public enum ResponseCodeEnum {
    /*
     *
     */
    INVALID("-1", "无效状态"),
    SUCCESSED("0000", "操作成功"),
    PROMPT_ERROR("0100", ""), //需要返回参数的异常
    USER_EXISTENCE("0001", "用户已存在"),
    ERR_BUSINESS("0002","业务级别的错误"),
    ERR_USER_INVALID("0201","用户不存在"),
    PARAMETER_ERROR("1000", "参数错误"),
    DATA_ERROR("2000", "数据错误"),
    ERRORED("2001","插入数据失败"),
    NETWORK_ERROR("3000", "网络错误"),
    MESSAGE_ERROR("4000", "报文错误"),
    ACCOUNTID_NOTFOUND("4001", "帐号不存在"),
    SIGNATURE_ERROR("4002", "请重新登录"),
    SIGNATURE_TIMEOUT("4003", "令牌过期"),
    USERPASSWORD_ERROR("4004","密码错误"),
    API_ERROR("4005", "该API暂未开通请联系管理员"),
    SALT_ERROR("4006","salt错误，请确认"),
    ACCESS_BARRED_ERROR("0403","流程级别的错误"),
    FILE_NOT_EXIST("5000","文件不存在"),
    FILE_EXIST("5001","文件已存在"),
    UNKNOWN_ERROR("9000", "未知错误"),
    SERVICENAME_NOTFOUND("9010", "服务名称错误或尚未提供指定服务"),
    APINAME_NOTFOUND("9020","API名称错误或尚未提供指定"),
    ASK_FOR_ERROR("0403","申请失败"),
    USER_STATUS_ERROR("3100","用户状态错误"),
    IN_LOAN("3101","申请借款中"),
    WAIT_FOR_PAYMENT("3102","支付结果确认中，请耐心等待"),
    ONCE_A_DAY("3103","U小钱每天仅支持一次借款，感谢您的支持，请明天再次申请。"),
    AUDIT_ERROR("3104","急速审核中"),
    IDENTIFICATION_ERROR("3105","银行卡识别错误"),
    BANK_ERROR("3106","暂不支持该银行！"),
    MEMORY_CARD("3107","银行卡仅支持储蓄卡！"),
    TIE_ON_CARD("3108","绑卡错误！"),
    NOT_TIE_ON_CARD("3109","用户未绑定银行卡，请补全银行卡信息！"),
    ORDER_REPEATED_COMMIT("3110","同一笔订单，请勿重复提交！"),
    LIANLIAN_ERROR("3111","调用连连失败"),
    INVESTMENT_ERROR("3112","该标目前无法投标，投标失败！"),
    INVESTMENT_OWN("3113","您不能投自己发布的标，投标失败！"),
    INVESTMENT_FULL("3114","此标已满，投标失败！"),
    INVESTMENT_STATUS_ERROR("3115","借款标状态异常！"),
    INVESTMENT_FOUNT("3115","借款标不存在！"),
    MODEL_ERROR("3116","读取协议模板出错！"),
    PDF_ESTABLISH("3117","pdf生成的路径不存在..."),
    REPAYMENT_ERROR("3118","当前借款标的状态不能进行还款操作！"),
    REPAYMENT_REPEAT("3119","该期借款已经还款,请不要重复操作！"),
    PREPAYMENT_ERROR("3120","提前还款失败"),
    COMPENSATORY_FAILURE("3121","代偿失败"),
    EXPERIENCE_COUPON("3122","体验券金额大于可投标金额，投标失败！"),
    REPAYMENT_DOES_NOT_SUPPORT("3123","等额本息不支持按天还款!"),
    WITHDRAWAL_IS_NOT_ALLOWED("3124","借款标的状态不允许撤回"),
    MIN_INTEREST_RATE_1("3125","最低利率不能低于1%"),
    MAX_INTEREST_RATE_22("3126","六个月份以内(含六个月)的贷款年利率不能高于22.4%"),
    LESS_THAN_MINIMUM_LIMIT("3127","六个月份以内(含六个月)的贷款年利率不能高于22.4%"),
    ACCOUNT_LOCKOUT("3128","您账号已经被锁定，不能进行投标!"),
    MINIMUM_TENDER_AMOUNT("3129","投标金额不能小于最小投标额！"),
    UNKNOWN_REAL_NAME("3130","您还未通过实名认证，投标失败！"),
    UNKNOWN_CELL_PHONE("3131","您还未通过手机认证，投标失败！"),
    BID_AMOUNT_IS_GREATER("3132","实际投标金额不能大于单笔最多投标总额，投标失败！ "),
    UPDATE_TENDER_ERROR("3133","更新tender记录状态失败"),
    LOAN_NOT_REPAID("3133","还有尚未还款的借款！"),
    INSUFFICIENT_CREDIT_LIMIT_AVAILABLE("3134","可用信用额度不足!"),
    NOT_ORDER("3135","为找到对应的订单"),
    GREATER_THAN_AVAILABLE_BALANCE("3136","投标金额不能大于您的可用余额！"),
    VALIDE_CODE_SEND_SUCCESS("0000", "验证码已发送"),
    
    //针对user响应信息mso
    ERR_PHONE_USED("0205","您所输入的手机号码已经注册，请直接登录"),
    ERR_PHONE_INVALID("0204", "手机号格式错误"),
    ACCESS_BARRED("0403", "验证码已发送，60秒后重新获取"),
    ACCESS_TIME_OUT("0404", "验证码已超时"),
    ACCESS_ERROR("0405", "验证码错误"),
    ACCESS_GET_ERROR("0406", "请先获取验证码"),
    ERR_USERNAME_USED("0203","用户名被占用"),
    ERR_USERNAME_INVALID("0202","用户名格式不正确"),
    ERR_PWD_INVALID ("0213","密码格式不正确"),
    ERR_NO_INVETER_PHONE_USER ("0226","邀请人不存在"),
    ERR_SENT_MSG_FAIL("0219", "短信接口功能性问题"),
    APP_INFORMATION_CONFIG_NOT_FOUND("0460","找不到APP信息配置"),
    ERR_USER_LOCKED_CAUSE_PWD("0214","用户被锁定，多次输入登录密码错误"),
    ERR_PWD_NOT_CORRECT("0217","密码错误"),
    EMPTY_RESULTSET("9995","身份证有效期为空"),
    ID_CARD_EXPIRED("0229","该身份证已到期"),
    PARAMS_FORMAT_ERROR("0230","身份证有效期格式错误"),
	ERR_REALNAME_NOT_AUTH("0210","该身份证已实名"),
	DELETE_PHONE_FAIL("0211","该身份证已实名"),
    ERR_PWD_REPEAT("0224","密码不一致"),
    BORROW_ID_ERROR("7000", "借款id不合法"),
    REPAYMENT_STATUS_DONE("7001", "还款记录，状态为已还款"),
    REPAYMENT_STATUS_WEB("7002", "还款记录，状态为网站垫付"),
    REPAYMENT_NOT_FOUND("7003", "未找到还款记录"),
    REPAYMENT_REPEAT_APPLY("7004", "已存在提前还款申请记录，请勿重复申请"),

    CHOSE_ONE_OPERATOR("7500", "请选择一个用户角色"),
    OPERATOR_NAME_NOT_EMPTY("7501", "用户名不能为空！"),
    OPERATOR_PWD_NOT_EMPTY("7502", "密码不能为空！"),
    OPERATOR_NAME_FORMAT("7503", "用户名长度必须是4-16位！"),
    OPERATOR_CONFIRMPASSWORD_NOT_EMPTY("7504", "确认密码不能为空！"),
    OPERATOR_CONFIRMPASSWORD_AND_PWD_NOT_EQUELS("7505", "两次输入的密码不一致！"),
    OPERATOR_ONE_OPERATOR("7549", "两次输入的密码不一致！"),
    CHOSE_ATLAST_ONE_OPERATOR("7548", "请至少选择一个用户"),
    OPERATOR_LOGIN_OUTTIME("7547", "登录已过期，请重新登录"),
    CHOOSE_ROLE_REFLECT_ROLE("7549", "请选择角色对应的菜单！"),
    PARAM_IS_EMPTY("7545", "输入参数为空"),
    FORMAT_NOT_RIGHT("7544", "修改失败，输入的值格式不正确!"),
    NID_IS_FOUND("7543", "该标识已存在"),
    PIC_IS_NOT_FOUND("7542", "图片不存在"),
    INPUT_MUST_CHINESE("7541", "输入格式不正确，请输入汉字"),

    MANAGE_LOGIN_IMG_INVALID("7506","图片验证码错误"),
    MANAGE_LOGIN_IMG_TIME_OUT("7507","图片验证码过期"),
    MANAGE_LOGIN_ACCOUNT_EMPTY("7508","用户名和密码不能为空"),
    MANAGE_ACCOUNT_DISABLE("7509","账号已被禁用"),
    MANAGE_ACCOUNT_ERROR("7510","站好或密码错误"),

    MANAGE_NO_POWER("7511","没有权限"),


    //针对banner图获取响应信息
    STATUS_ERROR("3800","当前状态不能修改！"),
    STATUS_VALUE_ERROR("3801","状态值相同，不能更改!"),
    ERR_BANNER_CAN_NOT_USE("8001","数据不存在"),
    ERR_NID("2002","nid数据不存在"),
	
	//web
	
	UNABLE_TO_PUSH("3210","所选汇盈的单子无法推标到其他资金方"),
	BE_RETURNED("3211","所选订单不能推给已经被退回的资金方"),
	SELECT_PUSH_MARK("3212","请选择未推标后再进行推标"),
	PUSH_MARK_ERROR("3213","系统已无未推的标"),
	NOT_ALL_UNABLE_TO_PUSH("3214","所选订单并非全部为可推送状态订单"),
	REPEATED_AUDIT("2315","已处理，请刷新页面!"),
	NO_INVESTOR("2316","没有对应的投资人!"),
    LOGIN_REPEAT_ERROR("4007","您的账号在其他机器登录");
	

    /**
     * 状态值
     */
    private String status;

    /**
     * 状态描述
     */
    private String desc;

    private ResponseCodeEnum(String status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public String getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据状态值获取枚举值
     *
     * @param status
     * @return
     */
    public static ResponseCodeEnum getStatus(String status) {
        for (ResponseCodeEnum e : ResponseCodeEnum.values()) {
            if (e.getStatus() == status) {
                return e;
            }
        }

        return INVALID;
    }

    /**
     * 根据状态值获取枚举值
     *
     * @param status
     * @return
     */
    public static ResponseCodeEnum getStatus(Integer status) {
        return status==null ? INVALID : getStatus(status.intValue());
    }

}